/*
package com.changzhi.service.impl;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.changzhi.ldyl.model.*;
import com.changzhi.mapper.ExternalChannelStatisticsMapper;
import com.changzhi.mapper.ExternalGroupStatisticsMapper;
import com.changzhi.mapper.ExternalUserBindingMapper;
import com.changzhi.mapper.UserInvitationConfigMapper;
import com.changzhi.service.StatisticsService;
import com.changzhi.util.RedisUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

*/
/**
 * @Description:
 * @author: 小落
 * @date: 2020年11月04日
 *//*

@Service
public class StatisticsServiceImpl implements StatisticsService {

	@Autowired
	private RedisUtil redisUtil;
	@Resource
	private ExternalUserBindingMapper externalUserBindingMapper;
	@Resource
	private UserInvitationConfigMapper userInvitationConfigMapper;
	@Resource
	private ExternalChannelStatisticsMapper externalChannelStatisticsMapper;
	@Resource
	private ExternalGroupStatisticsMapper externalGroupStatisticsMapper;

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void doMqDataByUserInvite(String msg) {
		UserInvitationAward invitationAward = JSON.parseObject(msg, UserInvitationAward.class);
		if(StringUtils.isBlank(invitationAward.getInviterUserId()) || invitationAward.getCreateTime() == null){
			return;
		}
		externalChannelStatistics(invitationAward);
		externalGroupStatistics(invitationAward);
	}

	*/
/**
	 * 公会 - 厅统计
	 *//*

	private void externalChannelStatistics(UserInvitationAward invitationAward){
		LambdaQueryWrapper<UserInvitationConfig> wrapper = new LambdaQueryWrapper<>();
		wrapper.eq(UserInvitationConfig::getUserId, invitationAward.getInviterUserId()).last("limit 1");
		UserInvitationConfig invitationConfig = userInvitationConfigMapper.selectOne(wrapper);
		if (invitationConfig == null || StringUtils.isBlank(invitationConfig.getSkipChannelId())) {
			return;
		}
		ExternalChannelStatistics statistics = new ExternalChannelStatistics();
		statistics.setChannelId(invitationConfig.getSkipChannelId());
		statistics.setCreateDate(invitationAward.getCreateTime().toLocalDate());
		externalChannelStatisticsMapper.insertOrUpdate(statistics);
	}

	*/
/**
	 * 公会 - 分组统计
	 *//*

	private void externalGroupStatistics(UserInvitationAward invitationAward){
		LambdaQueryWrapper<ExternalUserBinding> bindWrapper = new LambdaQueryWrapper<>();
		bindWrapper.eq(ExternalUserBinding::getUserId, invitationAward.getInviterUserId()).eq(ExternalUserBinding::getBindType, 2).last("limit 1");
		ExternalUserBinding userBinding = externalUserBindingMapper.selectOne(bindWrapper);
		if (userBinding == null || userBinding.getStatus() != 1) {
			return;
		}
		ExternalGroupStatistics statistics = new ExternalGroupStatistics();
		statistics.setGroupId(userBinding.getGroupId().intValue());
		statistics.setCreateDate(invitationAward.getCreateTime().toLocalDate());
		externalGroupStatisticsMapper.insertOrUpdate(statistics);
	}
}
*/
